package yf.mall.vo.app.dy;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.checkerframework.checker.units.qual.A;

import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class DyVideoVO {

    /**
     * 视频地址
     */
    private String videoUrl;

    /**
     * 音乐地址
     */
    private String musicUrl;

    /**
     * 封面地址
     */
    private String imgUrl;


    /**
     * 标题
     */
    private String title;

    /**
     * 耗时
     */
    private Long time;

    private List<String> images;

    public List<String> getImages() {
        if (images != null) {
            List<String> res = new ArrayList<>();
            for (String item : images
            ) {
                if (!item.contains("https")) {
                    item = item.replace("http", "https");
                }
                res.add(item);
            }
            return res;
        }
        return null;
    }


    public DyVideoVO(String videoUrl, String musicUrl, String imgUrl, String title, Long time) {
        this.videoUrl = videoUrl;
        this.musicUrl = musicUrl;
        this.imgUrl = imgUrl;
        this.title = title;
        this.time = time;
    }
}
